The Dreamweaver JavaScript API > String manipulation functions > dreamweaver.nativeToLatin1() |
![]() ![]() ![]() |
Availability
Dreamweaver 2.0
Description
Converts a string in native encoding to Latin 1 encoding.
Note: This function has no effect in Windows because Windows encodings are already based on Latin 1.
Arguments
stringToConvert
stringToConvert
is the string to be converted from native encoding to Latin 1 encoding.
Returns
The converted string.
Enabler
None.
The dreamweaver.scanSourceString()
function is a utility function that analyzes a string and deciphers where the HTML tags, attributes, and directives are located. Here is a scenario for using the dreamweaver.scanSourceString()
function:
1 | You create an implementation for one or more of the seven callback functions. |
2 | You write a script that calls the dreamweaver.scanSourceString() function. |
3 | The dreamweaver.scanSourceString() function is passed a string containing HTML and pointers to the callback functions that you have written. For example, suppose the string of HTML is "<font size=2>hello</font>" . |
4 | Dreamweaver analyzes the string and determines that the string contains a font tag. Dreamweaver calls the callback functions in the following sequence: |
![]() |
the openTagBegin() function |
![]() |
the attribute() function (for the size attribute) |
![]() |
the openTagEnd() function |
![]() |
the text() function (for the "hello" string) |
![]() |
the closeTagBegin() and closeTagEnd() functions |
![]() |
dreamweaver.scanSourceString callback functions
As mentioned, there are seven callback functions that Dreamweaver calls:
1 | Dreamweaver calls openTagBegin() for each opening tag (for example, <font> , as opposed to </font> ) and each empty tag (for example, <img> or <hr> ). The openTagBegin() function accepts two arguments: the name of the tag (for example, "font" or "img" ) and the document offset, which is the number of bytes in the document before the beginning of the tag. The function returns true if scanning should continue, or false if it should stop. |
2 | After openTagBegin() executes, Dreamweaver calls attribute() for each HTML attribute. The attribute() function accepts two arguments: a string containing the attribute name (for example, "color" or "src" ) and a string containing the attribute value (for example, "#000000" or "foo.gif" ). The attribute() function returns a Boolean indicating whether or not scanning should continue. |
3 | After all of the attributes in the tag have been scanned, Dreamweaver calls openTagEnd() . The openTagEnd() function accepts one argument: the document offset, which is the number of bytes in the document before the end of the opening tag. It returns a Boolean indicating whether or not scanning should continue. |
4 | Dreamweaver calls closeTagBegin() for each closing tag (for example, </font> ). The function accepts two arguments: the name of the tag to close (for example, "font" ) and the document offset, which is the number of bytes in the document before the beginning of the close tag. The function returns a Boolean indicating whether or not scanning should continue. |
5 | After closeTagBegin() returns, Dreamweaver calls the closeTagEnd() function. The closeTagEnd() function accepts one argument: the document offset, which is the number of bytes in the document before the end of the closing tag. It returns a Boolean indicating whether or not scanning should continue. |
6 | Dreamweaver calls the directive() function for each HTML comment, ASP script, JSP script, or PHP script. The directive() function accepts two arguments: a string containing the directive and the document offset, which is the number of bytes in the document before the end of the closing tag. The function returns a Boolean indicating whether or not scanning should continue. |
7 | Dreamweaver calls the text() function for each span of text in the document, that is, everything that is not a tag or a directive. Text spans include text that is not visible to the user, such as the text inside a <title> or <option> tag. The text() function accepts two arguments: a string containing the text and the document offset, which is the number of bytes in the document before the end of the closing tag. The text() function returns a Boolean indicating whether or not scanning should continue. |
![]() |
![]() ![]() ![]() |